﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace PostSubmit
{
    public partial class SetFiledEntity : Form
    {
        public SetFiledEntity()
        {
            InitializeComponent();
        }

        public void Bind()
        {
        }

        private void button1_Click(object sender, EventArgs e)
        {
            StringBuilder stringBuilder = new StringBuilder();
            try
            {
                for (int i = 0; i < dataGridView1.Rows.Count - 1; i++)
                {

                    string x = "sasdf(\"dd\")";
                    stringBuilder.Append("/// <summary>\n");
                    stringBuilder.AppendFormat("/// {0}\n", dataGridView1.Rows[i].Cells[2].Value);
                    stringBuilder.Append("/// </summary>\n");
                    stringBuilder.AppendFormat("[XmlElement(\"{0}\")]\n", dataGridView1.Rows[i].Cells[1].Value);
                    string fild = dataGridView1.Rows[i].Cells[0].Value.ToString();
                    stringBuilder.AppendFormat("public string {0}", System.Threading.Thread.CurrentThread.CurrentCulture.TextInfo.ToTitleCase(fild)).Append(" { get; set; }\n");
                }
                richTextBox1.Text = stringBuilder.ToString();
            }
            catch (Exception ex)
            {
                object op = ex;
                richTextBox1.Text = op.ToString();
            }
        }
    }
}
